<div ng-include src="'/api/xsrf'"></div>

<nav class="navbar navbar-default" ng-init="$parent.navbar_loaded=true">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
                <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#/">InPanel</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#/login">登录</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="alert alert-warning" style="display:none;" ng-show="loginWarning">
    <div class="container-fluid">
        <p>{{loginMessage}}</p>
        <p>系统检测到您当前密码安全等级为：<strong>“{{pwdStrength}}”</strong>。</p>
        <p>为保障系统安全，建议您更换一个安全等级更高的密码。</p>
        <p>高安全等级的密码具备以下特征：</p>
        <p>
            <ul>
                <li>至少包含一个大写和小写字母</li>
                <li>至少包含一个数字</li>
                <li>至少包含一个特殊字符</li>
                <li>密码长度至少为六位</li>
            </ul>
        </p>
        <p style="margin-top:20px">
            <a href="#/setting?s=authinfo" class="btn btn-primary">设置登录密码</a>&nbsp;&nbsp;
            <a href="#/" class="btn btn-default">直接进入主界面</a>
        </p>
    </div>
</div>

<div id="main">
    <form class="form-horizontal" ng-submit="login()" onsubmit="return false" method="get" action="/">
        <legend><span class="legend">登录</span></legend>
        <div ng-show="loaded">
            <div class="alert alert-info alert-dismissible" style="display:none" ng-show="showForgetPwdMsg">
                <button ng-click="showForgetPwdMsg=false" type="button" class="close"><span aria-hidden="true">&times;</span></button>
                <p>请在服务器上执行以下命令重置管理员的用户名或密码：</p>
                <p>* 重置用户名：inpanel config username '用户名'</p>
                <p>* 重置密码：  inpanel config password '密码'</p>
            </div>
            <div class="alert alert-warning alert-dismissible" style="display:none" ng-show="errorText != ''">
                <button ng-click="errorText=''" type="button" class="close"><span aria-hidden="true">&times;</span></button>
                <p>{{errorText}}</p>
            </div>
            <div class="form-group form-inline">
                <label class="col-sm-2 control-label" for="username">用户名</label>
                <div class="col-sm-10">
                    <input class="form-control" ng-model="username" ng-disabled="processing" type="text" id="username" placeholder="管理员用户名" autofocus autocomplete="off">
                </div>
            </div>
            <div class="form-group form-inline">
                <label class="col-sm-2 control-label" for="password">密码</label>
                <div class="col-sm-10">
                    <input class="form-control" ng-model="password" ng-disabled="processing" type="password" id="password" placeholder="管理员密码" autocomplete="off">
                </div>
            </div>
            <div class="form-group form-inline">
                <div class="col-sm-2 control-label"></div>
                <div class="col-sm-10">
                    <button type="submit" id="login" class="btn btn-default" ng-disabled="processing">
                        <i class="glyphicon glyphicon-user"></i> <span ng-bind-template="{{ loginText }}">登录</span>
                    </button>
                    <span style="padding-left:20px">
                        <a ng-click="showForgetPwdMsg=true" href="#" onclick="return false">忘记密码？</a>
                    </span>
                </div>
            </div>
        </div>
    </form>
</div>